# Contributor: Tom Gundersen <teg@jklm.no>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Gabriel Martinez < reitaka at gmail dot com >

pkgname=libimobiledevice
pkgver=1.3.0
pkgrel=8
pkgdesc="Library that talks the protocols to support iPhone and iPod Touch devices on Linux"
url="https://libimobiledevice.org/"
arch=(x86_64)
license=(GPL2 LGPL2.1)
depends=(
  gnutls
  libgcrypt
  libplist
  libtasn1
  libusbmuxd
)
makedepends=(
  autoconf-archive
  cython
  git
  python
  python-setuptools
)
provides=(libimobiledevice-1.0.so)
_commit=15f8652126664e3a4b980e5d1c039b9053ce8566
source=(
  "git+https://github.com/libimobiledevice/libimobiledevice#commit=$_commit"
  libplist-2.3.0.diff
)
b2sums=('SKIP'
        '136390910a57e70c3ce458ab5c6def4e079b7eb4c2946447102078ca511f8d112caf9460c074ecbb6c8a4f526e0aa50015d2f92acf66dbbb666bd007e361ee5e')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname

  # Update ac_python_devel.m4 to newer ax_python_devel.m4
  git cherry-pick -n eea4f1be91

  # Compatibility with libplist 2.3.0
  git apply -3 ../libplist-2.3.0.diff

  NOCONFIGURE=1 ./autogen.sh
}

build() (
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --disable-openssl
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
)

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}

# vim:set sw=2 sts=-1 et:
